<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .outer{
            width: 300px;
            height: 300px;
            background-color: red;
            padding: 50px;
            box-sizing: border-box;
        }

        .inner{
            width: 100px;
            height: 100px;
            background-color: green;
        }
    </style>
</head>
<body>
    
    <div class="outer" onclick="outer()">
        <div class="inner" onclick="test(event)">

        </div>
    </div>

    <script>
        function outer(){
            alert("父容器的单击事件!");
        }

        function test(event){
            let e = event||window.event;
            e.stopPropagation();
            alert("子容器单击事件!")
        }
    </script>
</body>
</html>